package jmine.tec.script.persistent.domain;

import bancosys.tec.persist.builders.AbstractDBBuilder;

/**
 * @author lundberg
 */
public class ScriptBuilder extends AbstractDBBuilder<Script> {

    private Script entity = this.createBean(Script.class);

    @Override
    protected Script doBuild() {
        return this.entity;
    }

    public ScriptBuilder mnemonico(String value) {
        this.entity.setMnemonico(value);
        return this;
    }

    public ScriptBuilder descricao(String value) {
        this.entity.setDescricao(value);
        return this;
    }

    public ScriptBuilder body(String value) {
        this.entity.setBody(value);
        return this;
    }

    public ScriptBuilder purpose(ScriptPurpose value) {
        this.entity.setPurpose(value);
        return this;
    }

    public ScriptBuilder language(ScriptLanguage value) {
        this.entity.setLanguage(value);
        return this;
    }

    public ScriptBuilder withApi(Script value) {
        this.entity.getApis().add(value);
        return this;
    }

    public ScriptBuilder withDependencies(String bean, String variable) {
        this.entity.getDependencies().add(new ScriptDependency(bean, variable));
        return this;
    }

}
